import akka.stm.Ref;
import akka.stm.Atomic;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class DayScheduler {
	private static final int DAYS = 15;
	private static final int HOURS_PER_DAY = 24;
	private static final int MINUTES_PER_HOUR = 60;
	
	final Ref<Long> daysElapsed = new Ref<Long>(0L);
	final Ref<Long> hoursElapsed = new Ref<Long>(0L);
	final Ref<Long> minutesElapsed = new Ref<Long>(0L);
	final Ref<Boolean> keepRunning = new Ref<Boolean>(true);
	
	private static final ScheduledExecutorService actionTimer =
		    Executors.newScheduledThreadPool(4);
	
	private void DayScheduler() {}
	
	public static DayScheduler create() {
	    final DayScheduler time = new DayScheduler();
	    time.init();
	    return time;
	}

	private void init() {
		// increment the time
		actionTimer.scheduleAtFixedRate( new Runnable() {
			
			@Override
			public void run() {
				
			}
			// re-occur 60*24 times a second
			
		}, 684, 684, TimeUnit.MICROSECONDS);
		
		// Schedule for re-stocking
		actionTimer.scheduleAtFixedRate( new Runnable() {
			public void run() {
				
			}
		}, 0, 6, TimeUnit.SECONDS);
		
	}

	public void endDays() { keepRunning.swap(false); }
	
}
